module.exports = {
	/**
	 * 查询角色列表
	 * @url client/wechat/selects/pub/selects 前端调用的url参数地址
	 * 表名
	 * @dbName 查询的表的名称
	 * data 请求参数 说明
	 * @param {String}         _id  用户编号
	 * res 返回参数说明
	 * @param {Number}         code      错误码，0表示成功
	 * @param {String}         msg       详细信息
	 */
	main: async (event) => {
		let { data = {}, userInfo, util, filterResponse, originalParam } = event;
		let { customUtil, uniID, config, pubFun, vk, db, _ } = util;
		let { uid } = data;
		let res = { code: 0, msg: '' };
		// 业务逻辑开始-----------------------------------------------------------
		let {dbName, user_id, comment, origin, day} = data;
		let { todayStart, todayEnd } = vk.pubfn.getCommonTime();
		
		let whereJson = {
			user_id
		}
		if(comment){
			whereJson.comment = new RegExp(comment)
		}
		if(origin){
			whereJson.origin = new RegExp(origin)
		}
		if(day) whereJson._add_time = _.gte(todayStart).lte(todayEnd)
		
		res.num = await vk.baseDao.count({
			dbName,
			whereJson
		});
		// 业务逻辑结束-----------------------------------------------------------
		return res;
	}

}